package com.bf.electroplating.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bf.electroplating.pojo.dto.IdDTO;
import com.bf.electroplating.pojo.dto.examiningreport.ComExaminingReportDTO;
import com.bf.electroplating.pojo.dto.examiningreport.ComExaminingReportQueryDTO;
import com.bf.electroplating.pojo.vo.ResultVO;
import com.bf.electroplating.pojo.vo.examiningreport.ComExaminingReportVO;
import com.bf.electroplating.service.ComExaminingReportService;
import com.bf.electroplating.util.idempotent.Idempotent;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping ( "/com-Examinieng-report" )
@Tag ( name = "自行检测报告管理", description = "自行检测报告管理相关接口" )
public class ComExaminingReportController {

	@Resource
	private ComExaminingReportService comExaminingReportService;

	@PostMapping ( "/page" )
	@Operation ( summary = "分页查询自行检测报告管理列表", description = "分页查询自行检测报告管理列表" )
	public ResultVO < Page < ComExaminingReportVO > > pageList ( @RequestBody ComExaminingReportQueryDTO queryDTO ) {
		return comExaminingReportService.pageList ( queryDTO );
	}

	@Idempotent
	@PostMapping ( "/saveData" )
	@Operation ( summary = "新增自行检测报告管理", description = "新增自行检测报告管理" )
	public ResultVO < String > saveData ( @RequestBody @Validated ComExaminingReportDTO dto ) {
		return comExaminingReportService.saveData ( dto );
	}

	@PostMapping ( "/delete" )
	@Operation ( summary = "删除自行检测报告管理", description = "删除自行检测报告管理" )
	public ResultVO < String > delete ( @RequestBody List < String > ids ) {
		return comExaminingReportService.delete ( ids );
	}

	@PostMapping ( "/detail" )
	@Operation ( summary = "获取自行检测报告管理详情", description = "获取自行检测报告管理详情" )
	public ResultVO < ComExaminingReportVO > getDetail ( @RequestBody IdDTO idDTO ) {
		return comExaminingReportService.getDetail ( idDTO.getId () );
	}


}
